package org.example.order.infrastructure.repo.converter;

import org.example.order.domain.*;
import org.example.order.infrastructure.po.OrderDetailPO;
import org.example.order.infrastructure.po.OrderPO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public interface OrderConverter {
    OrderConverter INSTANCE = Mappers.getMapper(OrderConverter.class);

    @Mapping(source = "orderPO.id", target = "id")
    Order convert(OrderPO orderPO, Org org, Customer customer);

    @Mapping(source = "orderDetailPO.id", target = "id")
    OrderDetail convert(OrderDetailPO orderDetailPO, Product product);

}
